<?php
namespace app\message\model;

use think\Model;


/**
 * Created by PhpStorm.
 * User: wanghaibo
 * Date: 18/2/1
 * Time: 16:10
 */
class MessageModel extends Model
{
    protected $autoWriteTimestamp = true;
    public function addMessage($data){
        return $this->allowField(true)->data($data,true)->isUpdate(false)->save();
    }
    public function getList(){
        $where = [
            'create_time' => ['>=', 0],
        ];

        $messages        = $this->where($where)
            ->order('update_time', 'DESC')
            ->paginate(10);

        return $messages;
    }
}